package com.youmu.shop.order.service;

import java.util.List;
import java.util.Map;

import javax.servlet.ServletContext;

import com.youmu.shop.biz.bean.DispatchingParam;
import com.youmu.shop.order.bean.OrderBean;
import com.youmu.shop.order.bean.OrderItemBean;
import com.youmu.shop.order.vo.DispatchingOrder;
import com.youmu.shop.order.vo.OrderDetailVo;
import com.youmu.shop.order.vo.OrderVo;
import com.youmu.shop.order.vo.ShippingMethodVo;
import com.youmu.shop.param.CalculateFreightParam;
import com.youmu.shop.system.bean.Admin;
import com.youmu.shop.system.bean.Shop;
import com.youmu.shop.weixin.vo.WeixinInfo;

/**
 * 订单接口
 * @author yjh
 *
 */
public interface OrderService {

	/**
	 * 根据订单状态查询订单
	 * @param orderStatus
	 * @return
	 */
	List<OrderVo> findOrderByStatus(Integer orderStatus,Long userId);

	/**
	 * 查询订单明细
	 * @param orderId
	 * @return
	 */
	OrderDetailVo findOrderDetail(Long orderId);

	/**
	 * 创建订单
	 * @param orderBean
	 * @return
	 */
	long createOrder(OrderBean orderBean);

	/**
	 * 微信支付
	 * @param orderId
	 * @param amount
	 * @param remoteAddr
	 * @return
	 */
	Map<String, Object> payWeixin(Long orderId, Double amount, String remoteAddr);

	/**
	 * 微信支付回调
	 * @param body
	 * @return
	 */
	String notifyWeixin(String body);

	/**
	 * 取消订单
	 * @param id
	 */
	void cancelOrder(Long id);

	/**
	 * 获取再次购买的商品项
	 * @param orderId
	 * @return 
	 */
	List<OrderItemBean> getBuyAgain(Long orderId);

	/**
	 * 根据用户获取积分抵扣金额
	 * @param userId
	 * @return 
	 */
	double getShopingPointByUserId(Long userId);

	/**
	 * 根据订单号查询外部物流订单号
	 * @param orderId
	 * @return
	 */
	String getShippingByOrderId(Long orderId);

	/**
	 * 根据订单id和用户id获取实付款
	 * @param orderId
	 * @param userId
	 * @return
	 */
	Double getPaidAmountByInfo(Long orderId, Long userId);
	
	

    /**
     * 查询所有配送类型
     * @param methodId
     * @return
     */
    List<ShippingMethodVo> getShippingMethod();

    /**
     * 配送端订单查询
     * @param adminId
     * @param orderStatus
     * @return
     */
    List<DispatchingOrder> selectOrdersForDispatchingAdmin(Admin admin, Integer orderStatus, Integer currentPage);
    
    /**
     * 根据订单主键查询订单详情
     * @param orderId
     * @return
     */
    List<OrderItemBean> selectOrderItemsByOrder(Long orderId);
    
    /**
     * 配送人员接单
     * @param dispatchingParam
     */
    void orderTaking(ServletContext servletContext ,DispatchingParam dispatchingParam, Admin admin);
    
    /**
     * 配送端查询我的工单
     * @param adminId
     * @return
     */
    List<DispatchingOrder> selectDispatchingByAdmin(Admin Admin, Integer orderStatus, Integer currentPage);
    
    /**
     * 配送人员完成送达
     * @param dispatchingParam
     */
    void orderFinish(ServletContext servletContext ,DispatchingParam dispatchingParam, Admin admin);
    
    /**
     * 根据圈子计算运费
     * @param productIds
     * @param receiverAddress
     * @param cityCode
     * @return
     * @throws Exception 
     */
    Object calculateFreightByProductTypeAndReceiverAddress(CalculateFreightParam calculateFreightParam) throws Exception;
    
    /**
     * 查询自营配送圈子集合
     * @return
     */
    List<Shop>selectSelfSupportShipping();
    
    /**
     * 查询闪送圈子集合
     * @return
     */
    List<Shop>selectSendFlash();
    
    /**
     * 确认收货
     * @param orderId
     * @return
     */
    Integer confirmReceipt(Long orderId);
}
